﻿//***************************************************************************//
//                                                                           //
//Author:       Kris Henry                                                   //
//Class Name:   HUD.cs                                                       //
//Pupose:       Handle the drawing and  for the for the                      //
//              ingame attributes                                            //
//Date :        December 2012                                                //
//                                                                           //
//***************************************************************************//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;


namespace Indie_Game_Contest
{
    class HUD
    {
        private static HUD instance;
        private int count;
        private int hudFont;
        private int score;
        private int highScore = -1;
        private int num_lives = 3;
        private int health ;
        private int life_icon;
        private float scale = 2.0f;
        private bool scaling;
        private float num_health ;

        bool done;
        private HUD()
        {
           
        }
       
        public void Update()
        {
            if (count % 10 == 0)
            {
                
                

            }

            if (scaling)
            {
                scale += 0.01f;
                if (scale > 2.0f)
                    scaling = false;
            }
            else
            {
                scale -= 0.01f;
                if (scale < 1.0f)
                    scaling = true;

            }
            
            count++;


        }
        public void Enter()
        {
            WorldData.spriteBatch.GraphicsDevice.Reset();
            done = false;
        }
        public void Draw()
        {
            Rectangle src_life = new Rectangle(0, 0, 30, 30);
            Rectangle src_health = new Rectangle(0,0,(int)(100 * (Num_health * 0.01f)),12);
            WorldData.spriteBatch.Draw(TextureManager.Instance.GetTexture(Health), new Vector2(20, 100), src_health, Color.White, 0.0f, new Vector2(20, 20), 2.0f, SpriteEffects.None, 1);
            WorldData.spriteBatch.Draw(TextureManager.Instance.GetTexture(Life_icon), new Vector2(40, 40), src_life, Color.White, 0.0f, new Vector2(20, 20), Scale, SpriteEffects.None, 1);
            WorldData.spriteBatch.DrawString(TextureManager.Instance.GetSpriteFont(IntroState.Instance.IntroFont1), " x" + Num_lives, new Vector2(60, 30), Color.Black);
            WorldData.spriteBatch.DrawString(TextureManager.Instance.GetSpriteFont(IntroState.Instance.IntroFont1), " Score: " + Score, new Vector2(550, 30), Color.Black);
            WorldData.spriteBatch.DrawString(TextureManager.Instance.GetSpriteFont(IntroState.Instance.IntroFont1), " High Score", new Vector2(306, 10), Color.Black);
            WorldData.spriteBatch.DrawString(TextureManager.Instance.GetSpriteFont(IntroState.Instance.IntroFont1), highScore.ToString(), new Vector2(306, 35), Color.Black);
        }
        public static HUD Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new HUD();
                }
                return instance;
            }
        }
        public int Score
        {
            get { return score; }
            set { score = value; }
        }
        public int HudFont
        {
            get { return hudFont; }
            set { hudFont = value; }
        }
        public float Num_health
        {
            get { return num_health; }
            set { num_health = value; }
        }
        public int Num_lives
        {
            get { return num_lives; }
            set { num_lives = value; }
        }
        public int HighScore
        {
            get { return highScore; }
            set { highScore = value; }
        }
        public float Scale
        {
            get { return scale; }
            set { scale = value; }
        }
        public int Life_icon
        {
            get { return life_icon; }
            set { life_icon = value; }
        }
        public int Health
        {
            get { return health; }
            set { health = value; }
        }
    }
}
